
###   导入包   ###
from pyhandylang.Lexer import Lexer
from pyhandylang.Parser import Parser
import ply.yacc as yacc

###   程序示例   ###
textF = open('test.ply')
text = textF.read()

###   解释器   ###
parser = yacc.yacc(module=Parser)
print('===============LEX===============')
ast = parser.parse(text, lexer=Lexer())
print('===============AST===============')
if ast == None:
    print('AST == None')
else:
    print(ast.getTree())
print('===============EXE===============')
if ast == None:
    print('AST == None')
else:
    ast.exe()
print('===============IDS===============')
from pyhandylang.Ast import callStack
print('ids = ', callStack.currentFrame())
print('===============END===============')
from pyhandylang.Parser import printPNum
print('printPNum = ', printPNum)



